if (top.location !== self.location) {
    top.location=self.location;
 }
function goback(){
		var url=location.href;
		var arr=url.split('/');
		var page=arr[arr.length-1];
		var narr=page.split('.html')[0];
		if(narr=='detail' || narr=='comment' ){
			location.href='new_app.html#s123456789';
		}
		else{window.history.go(-1);}
		return;
	}
function loadFail(){
	var s='<div id="loadFail" class="loadFail"><span>加载失败</span><a onclick="removeFail();">确&nbsp;&nbsp;&nbsp;&nbsp;定</a></div>',
	    newobj=document.createElement('div');
		newobj.id='failBox';
	newobj.innerHTML=s;
	document.body.appendChild(newobj);
	obj_local2('failBox');
}
function removeFail(){
	var o=document.getElementById('failBox');
		if(o){
			document.body.removeChild(o);
			}
		else{
			alert('错误，请刷新页面!');
			}	
	}
function obj_local2(obj_id){
		var obj=$('#'+obj_id)
		var screenWidth = $(window).width(), screenHeight = $(window).height();  //当前浏览器窗口的 宽高23    
		var scrolltop = $(document).scrollTop();//获取当前窗口距离页面顶部高度24    25     
		var objLeft = (screenWidth - obj.width())/2 ;        
		var objTop = (screenHeight - obj.height())/2 + scrolltop;      
		obj.css({left: objLeft + 'px', top: objTop + 'px'});   
	//浏览器窗口大小改变时30      
		$(window).resize(function() {
			screenWidth = $(window).width();
			screenHeight = $(window).height();
			scrolltop = $(document).scrollTop();
			objLeft = (screenWidth - obj.width())/2 ;            
			objTop = (screenHeight - obj.height())/2 + scrolltop;
			obj.css({left: objLeft + 'px', top: objTop + 'px'});
		});//浏览器有滚动条时的操作、42      
		$(window).scroll(function() {			
			screenWidth = $(window).width();
			screenHeight = $(window).height();
			scrolltop = $(document).scrollTop();
			objLeft = (screenWidth - obj.width())/2;
			objTop = (screenHeight - obj.height())/2 + scrolltop;			
			obj.css({left: objLeft + 'px', top: objTop + 'px'});
		});
}
window.onscroll=function(){
		obj_local2('failBox');
	};
function id(e){
	return document.getElementById(e);
	}
function showLoading(){
	id('more').innerHTML='<img src="/styles/izhu/img/nav/load.gif" />';
}
function hideLoading(){
	id('more').innerHTML='更多...';
}

function cbrowser(){	
	if(!document.getElementById('cbrowser')){
		var c="<p>请使用360浏览器或者快用浏览器进行下载安装</p><a class=\"cbrowser_btn\" onClick=\"removebrowser()\">确&nbsp;&nbsp;认</a>";	
		var b=document.createElement('div');
		b.id='cbrowser';
		b.className='cbrowser';
		b.innerHTML=c;	
		document.body.appendChild(b);		
	}
	obj_local2('cbrowser');
}
function version_disabled(){	
	if(!document.getElementById('cbrowser')){
		var c="<p>系统版本低于应用所需最低版本，请升级系统版本。</p><a class=\"cbrowser_btn\" onClick=\"removebrowser()\">确&nbsp;&nbsp;认</a>";	
		var b=document.createElement('div');
		b.id='cbrowser';
		b.className='cbrowser';
		b.innerHTML=c;	
		document.body.appendChild(b);		
	}
	obj_local2('cbrowser');
}
function trim(str) {
   if (str == null) {
    return "";
   }
   return str.replace(/^\s*(.*?)[\s\n]*$/g,'$1');  
} 
function subString(str, len, hasDot){
	str=str;
	var newLength = 0;
	var newStr = "";
	var chineseRegex = /[^\x00-\xff]/g;
	var singleChar = "";
	var strLength = str.replace(chineseRegex,"**").length;
	for(var i = 0;i < strLength;i++)
	{
	singleChar = str.charAt(i).toString();
	if(singleChar.match(chineseRegex) != null)
	{
	newLength += 2;
	}
	else
	{
	newLength++;
	}
	if(newLength > len)
	{
	break;
	}
	newStr += singleChar;
	}
	
	if(hasDot && strLength > len)
	{
	newStr += "...";
	}
	return newStr;
}		  

function vLen(){
	var str= $('.so_text').val();							
	$('.so_text').val(subString(str,30));
}

$('.so_text').keyup(function(){
    vLen();
    //clearInterval(ser_text_timer);
	//var ser_text_timer=setInterval(vLen,100);
})

function removebrowser(){
	var o=document.getElementById('cbrowser');	
	document.body.removeChild(o);
}

//弹窗显示

function loadPop(){
	var str='<div class="loadpop_img"><img alt="加载中" src="/styles/izhu/img/nav/defaultky.png" /></div><div class="loadpop_cont"><img src="/styles/izhu/img/nav/load.gif" width="45" /><span>加载中 请稍后</span></div>';
	var newnode=$("<div id='load_pop' class='load_pop'></div>");
	newnode.html(str);
	$("body").append(newnode);
	obj_local2('load_pop');
	/*var newnode=document.createElement('div');	
	newnode.className="load_pop";
	newnode.id="load_pop";
	newnode.innerHTML=str;
	document.body.appendChild(newnode);
	obj_local2('load_pop');*/
}
function removePop(){
	$("#load_pop").remove();
	/*
	var o=document.getElementById('load_pop');
	if(o){
		document.body.removeChild(o);
	}*/
}
function beginload(e){	
	if(e=='success'){
		var loadnode=$('<div class="begin_load"></div>');
		loadnode.html('<span class="b_loadspan">加载中...</span>');
		return loadnode;	
	}
	if(e=='fail'){
		var loadnode=$('<div class="begin_load"></div>');
		loadnode.html('<span class="f_loadspan">加载失败</span>');
		return loadnode;	
	}
}
obj_local2('cbrowser');
obj_local2('failBox');
obj_local2('fa_succ');

//短信
function getAppName(){
	var app=document.getElementById('_appName');
	if(app){	
		return app.innerHTML;
	}
	else{
		return false;
	}
}
/*
function adloading(){	
		var i=document.getElementById("loading");
		if(i){
			//obj_local2("#loading");
		}else{
			var n=document.createElement("div");
			n.id="loading";
			n.className="loading";
			document.body.appendChild(n);
			n.innerHTML='<img src="../img/load.gif" class="loading_gif" /><span>加载中，请稍候...</span>';
		}
		obj_local2("loading");
	}
$(document).ready(function(){
	
})
window.onload=function(){
	$(".nav_tit li a").click(function(){	
		 //判断是否是当前页
		var sclass=$(this).parent().attr('class').toString();
		
		if(sclass.indexOf('curr')>0){
				 return; 
		}else{
			$(this).parent().addClass(sclass+"_curr");
			//非当前页
			adloading();
			}	
	 });
	$(".list_ac,.nav_so,.nav_two ul li,.d_nav_r,.d_nav_left,.so_btn").click(function(){
		adloading();							 
	});

}*/


